home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM BV3 / BMUG PD-ROM Version BV3 (CDRM1097900).iso / Telecom / Utilities / HangUp / HangUp Doc next >
Text File  |  1991-10-14  |  13KB  |  100 lines

  1. HangUp
  2. Copyright © 1991 by Bob Blaylock
  3.  
  4.   These files may be freely distributed and used, so long as the following Conditions are met:
  5.  
  6.   •  All of these files must be distributed together.  You may not distribute only a part of this set.  The complete set includes the following files:
  7.  
  8.      HangUp.doc     This text file which you are reading now.
  9.      HangUp FKEYs   A file containing four FKEYs.
  10.      HangUp.PROC    A White Knight (tm) Procedure.
  11.  
  12.   •  This copyright statement must accompany any copy of this package which is distributed.  This statement must not, under any circumstances, be altered in any way.
  13.  
  14.   •  If you distribute any copies of this package, in which any of the files have been altered, then you must, at the end of this document, add a paragraph or so describing the alterations which you have made.
  15.  
  16.   •  No other copyrights may be claimed on this package, or any files contained therein, either by itself, or as part of a larger collective work, nor may any restrictions be placed upon the further distribution of this package, other than those listed in this copyright statement.
  17.  
  18.   •  This package may not, under any circumstances, be uploaded to, or distributed by, CompuServe Information Services.
  19.  
  20.  
  21. Who Can Use HangUp:
  22. -------------------
  23.  
  24.   This document assumes a fair degree of electronic skill, and knowledge of the Macintosh hardware.  At the every least, you should be capable of wiring a modem cable.
  25.  
  26.   Anyone who is using a modem that supports MNP5, V.42bis, or any other conditions which may result in the serial port connection between the modem and the computer being at a higher rate than the actual throughput of the modem, and who is using a Macintosh which is compatible with this package, may benefit from it.
  27.  
  28.   This package was developed on an original 68020-based Macintosh II, under System 7.0.  It is known to be compatible on this machine, under this environment.  I see no reason why it should be incompatible with any other version of the system software, either past, or future.  It should be compatible with most Macintosh models.
  29.  
  30.   Though I have not had an opportunity to test this, I think this software is NOT compatible with the Macintosh IIfx.  This software writes directly to the 8530 SCC chip, which, in the Mac IIfx, is isolated from the CPU by some other chips.  According to "Guide to the Macintosh Hardware", Second Edition, attempting to directly access the SCC on a Macintosh IIfx will result in a bus error.
  31.  
  32.   This software should work on any Macintosh model earlier than the IIfx.  At this writing (October 13th, 1991), the only existing models which I am not resonably sure about compatibility with this software are the Macintosh LC and the Macintosh IIsi.  Of course any future models which, like the IIfx, isolate the 8530 from the CPU, or which do not have their serial ports based on the 8530 at all, will not be compatible with this software.
  33.  
  34.  
  35. What It's For:
  36. --------------
  37.  
  38.   Back in the days when modems were much simpler, having a single handshaking line in each direction on the Macintosh serial ports was enough.  You'd use the HSKo line (Handshake Out) line to drive the DTR line on the modem, and probably not use the HSKi (Handshake In) line at all.
  39.  
  40.   With protocols like MNP5 and V.42bis, many newer modems require some form of flow control between themselves and the computers to which they are attached, in order to prevent the computer from trying to send data out the modem faster than the modem can send it, or to prevent the modem from sending data to the computer faster than the computer can process it.  This is usually done by hardware handshaking.
  41.  
  42.   In the context of a Macintosh, this means using the HSKi and HSKo lines to perform this handshaking, which is fine, except that it leaves no extra line for the Macintosh to use to drop the DTR on the modem to hang up.
  43.  
  44.   As it turns out, the RTS line from the 8530 is used to tristate the TxD+ and TxD- lines on the Macintosh serial ports.  When RTS is high, TxD+ and TxD- display opposite voltage levels, depending on the state of the TxD output on the 8530.  When RTS is low, TxD+ and TxD- are in the open state; providing no voltage, and a high impedance.
  45.  
  46.   The HangUp RCMD (for use in White Knight) and the various HangUp FKEYs cause the RTS output of the 8530 to be dropped for one second, then raised again.  With a specially-wired cable (which will be described shortly), the high-impedance state of the TxD+ and TxD- lines will result in a low state being passed momentarily to the DTR line on the modem.
  47.  
  48.  
  49. How To Wire the Cable:
  50. ----------------------
  51.  
  52.   First, you need to find out something about your modem.  By convention, the modem should expect a positive voltage in the range +5 to +15 volts on the DTR line as a high state, and a negative voltage in the range -5 to -15 volts for a low state.  Anything between -5 and +5 volts is supposed to be undefined.  In other words, it is not clearly defined how the DTR line should read if no clear voltage is present on it.  What you need to find out is which way the DTR line "floats" when there is no signal to pull it one way or the other.
  53.  
  54.   Does your modem have a light on the front labeled "TR" or "DTR"?  If so, this test will be easy.  if not, it'll be a bit harder.  In any event, begin the test by making sure that the DTR line on your modem is fully enabled.  On some older modems, this is a DIP switch setting.  On most newer modems, this is accomplished by sending it the command "AT&D2".
  55.  
  56.   With the DTR line fully enabled, your modem connected by a proper cable to your Macintosh, and a properly set-up terminal program running, the DTR light on your modem, if present, should be lit.  If you have such a light on your modem, disconnect the cable (I mean the cable between the modem and the computer, not the one to the phone line.) from the modem, and see what this light does.  If it goes out, then your modem's DTR line floats low.  If the light stays on, then the DTR line floats high.
  57.  
  58.   If you do not have a DTR light, then you'll have to try a more complicated experiement.  Dial out to some BBS or some other modem, which won't be terribly screwed if you hang up suddenly.  After your modem has established a connection with the other, disconnect your modem cable.  (Again, I mean the cable between the modem and the computer, not the one to the phone line.)  If your modem hangs up, then the DTR line floats low.  If it does not hang up, then the DTR floats high.
  59.  
  60.   OK, now that you know which waythe DTR line on your modem floats, we're ready to start wiring the cable.  First, I'll list the easy connections...
  61.  
  62.   DIN-8 (Macintosh)  DB-25 (Modem)
  63.   HSKo  1  ------------->  4  RTS
  64.   HSKi  2  <-------------  5  CTS
  65.   TxD-  3  ------------->  2  TxD
  66.   Gnd   4  --------------  7  Gnd
  67.   RxD-  5  <-------------  3  RxD
  68.   TxD+  6  Not Connected (Yet)
  69.   GPi   7  <-------------  8  DCD
  70.   RxD+  8  (Connect to pin 4 on the same connector)
  71.  
  72.   The cable, as wired so far, would be a good standard cable for using a handshaking modem with a Macintosh, if you weren't using HangUp.  You would, of course, have to disable the DTR line on the modem.
  73.  
  74.   Now, get two diodes.  It really doesn't much matter what kind of diodes.  I cannot right now imagine any diodes that wouldn't work.  Connect the cathodes of the two diodes together, and to pin 20 on the DB25.  Connect the anode of one diod to pin 3 on the DIN-8, and the anode of the other to pin 6 on the DIN-8.  Except when the TxD lines are tristated by dropping the RTS output on the 8530, one of the TxD lines will always have a positive voltage, and the other will have a negative voltage.  Therefore, connecting each of them to the DTR line in this manner will insure that there is a positive voltage on the DTR line.  When the RTS signal is dropped, and the TxD lines go open, then this voltage will be removed.
  75.  
  76.   In the most ideal case, this is all you need to do with the cable.  If your modem's DTR line floats low, then when the TxD lines are tristated, and the voltage removed, the DTR line will be allowed to float low, and if the DTR line is properly enabled on your modem, this will make it hang up.
  77.  
  78.   If your modem's DTR input floats high, then you'll need to do a bit more.  Alas, this can get awkard.  What you need in this case is to provide a negative voltage, through a resistor, to pull the DTR line down when the voltage from the TxD lines, via the diodes, is removed.  Alas, no such low voltage is available on the Macintosh's port, nor on most modems, as far as I know.  If your modem has a pin on it which can be counted on to have a sufficient negative voltage, then this will make things easier.  (A few hours after initially writing this paragraph, it occurs to me that I think most modems have a Ring Indicator signal on pin 22.  I think that this signal, except when the phone line to which the modem is connnected is ringing, has the negative voltage level on it that you need.)  Just take a resistor, of about 1KΩ or 2.2KΩ, and connected it between this pin and pin 20 on the DB25.  Otherwise, you'll just have to provide the voltage in some other way.  I would suggest a standard power adaptor, of the sort you can get at Rat Shack.  Make sure it has an output of somewhere in the range from 5 to 15 volts DC.  Connect the positive output of this adaptor to the signal ground (pin 7 on the DB25).  Connect the negative output through a resistor, in the 1KΩ to 2.2KΩ range, to the DTR line (pin 20 on the DB25).
  79.  
  80.   There is one other problem, which I know of, that may require some correction in the cable.  When I said that except when tristated, one of the TxD lines ALWAYS has a positive voltage, and the other a negative, I wasn't being entirely truthful.  As it turns out, during a transition in the TxD state from 0 to 1 or vice versa, for an very short moment, there may not be a voltage.  It turns out that my modem seems to have a "hair trigger" DTR line.  An extremely short drop in the DTR line is sufficient to make it hang up, or to in other ways adversely affect the operation of the modem.  I do not think this is how most modems behave.  I think most modems require a longer drop on the DTR line; some modems even let you specify how long the drop must be.
  81.  
  82.   I solved this problem by connecting a 100µF capacitor and a 2.2KΩ resistor in parallel from the DTR line (pin 20 on the DB25) to the signal ground (pin 7 on the DB25).  This is for the case where the modem's DTR line floats low.  If you're building a cable for the case where the DTR floats high, simply place a 100µF capacitor in parallel with the resistor that you're already been told to put between the DTR line and your negative voltage source.
  83.  
  84.   This should be all you need as far as building a cable.
  85.  
  86.  
  87. Using the Software:
  88. -------------------
  89.  
  90.   The software is included in two forms.  HangUp.PROC is a procedure to be called under White Knight.  You may invoke it with the Initiate Procedure… command in White Knight, or set up a keyboard macro which calls it.  You may also call this procedure from your own procedures by using the NEST statement.
  91.  
  92.   The actual HangUp code is in an RCMD resource contained in the resource fork of HangUp.PROC.  This RCMD automatically determines which serial port you're using, and how many bits/character.  HangUp needs to know this, because the same 8530 register that is used to control the RTS line also sets the bits/character.
  93.  
  94.   The other form in which HangUp is provided is a set of FKEYs.  Since the FKEYs have no way of knowing which serial port you're using, or how many bits/character, you'll need to make sure you invoke the correct one.  At this writing, four are provided.  HangUp A8 and HangUp A7 are to be used for the modem port, with 8 and 7 bits/character respectively.  Similarly, HangUp B8 and HangUp B7 are for use with the printer port.  You may renumber these FKEYs with ResEdit to invoke them in the normal way; better yet, get a utility like QuickKeys which you can use to assign a more logical keystroke to them.
  95.  
  96.   I guess there's not a whole lot more to say about this software.  When any form of this software is invoked, it simply writes to the 8530 SCC to tell it to drop the RTS line (which results in the  TxD lines on the serial port being opened) waits one second, then writes the SCC again to raise the RTS signal.
  97.  
  98.   For comments, bug reports, suggestions, or whatever, I can be reached most readily at the Bowhead Whale BBS, at (805)964-UNIX.  Just send mail there to "Bob Blaylock".
  99.  
  100.   I can also be reached less quickly on America OnLine by the name "TheBob", or on GEnie, as "B.Blaylock".